#include <iostream>
#include "../comm/sqliteManager.hpp"

int main() {
    SQLiteManager dbManager("../comm/Databases/userInfo.db");

    if (!dbManager.openDatabase()) {
        std::cerr << "Error opening database: " << dbManager.getErrorMessage() << std::endl;
        return 1;
    }

    dbManager.executeQuery("DELETE FROM users;");

    dbManager.executeQuery("INSERT INTO users (name, password, email, phone, gender, description) VALUES ('Alice', 'password123', 'john@example.com', '123-456-7890', 'Female', 'Test user');");
    dbManager.executeQuery("INSERT INTO users (name, password, email, phone, gender, description) VALUES ('Bob', 'password123', 'john.doe@example.com', '123-456-7890', 'Male', 'Test user');");

    std::string name1 = "Alice";
    auto results = dbManager.getUserInfoByName(name1);

    for (const auto& row : results) {
        for (const auto& cell : row) {
            std::cout << cell << " ";
        }
        std::cout << std::endl;
    }

    std::string name2 = "Bob";
    results.clear();
    results = dbManager.getUserInfoByName(name2);

    for (const auto& row : results) {
        for (const auto& cell : row) {
            std::cout << cell << " ";
        }
        std::cout << std::endl;
    }

    dbManager.closeDatabase();
    return 0;
}
